package com.car.loan.project.xr.util.vo;

import com.car.loan.project.xr.domain.LoanAlbum;
import com.car.loan.project.xr.util.bo.business.CustomerAddBo;
import com.car.loan.project.xr.util.bo.business.LoanAlbumBo;
import com.car.loan.project.xr.util.repayment.RepaymentPlan;
import com.car.loan.project.xr.util.vo.LoanDetailVo.LoanBaseInfoVo;
import com.car.loan.project.xr.util.vo.after.OverdueAdvancesInfo.AdvancesInfo;
import com.car.loan.project.xr.util.vo.after.OverdueUrgentLogInfo.UrgentLog;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.google.common.collect.Lists;
import io.swagger.annotations.ApiModelProperty;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import lombok.Data;

/**
 * @author huangding
 * @date 2020/2/27 17:34
 */
@Data
public class SearchUrgentInfoVo {

    @ApiModelProperty(value = "用户信息", required = true)
    private CustomerAddBo customerInfo;

    @ApiModelProperty("基本数据")
    private LoanBaseInfoVo loanBaseInfo;

    @ApiModelProperty("业务信息")
    private BusinessInfo businessInfo;

    @ApiModelProperty("车辆信息")
    private CarInfo carInfo;


    @ApiModelProperty("逾期垫款信息")
    private AdvancesOverdueInfo advancesOverdueInfo;

    @ApiModelProperty("还款计划")
    private List<RepaymentPlan> repaymentPlans;

    @ApiModelProperty("附件信息,map类型，key等于附件类型")
    private Map<Integer, List<LoanAlbumBo>> loanAlbumMap;

    @ApiModelProperty("逾期记录")
    private List<OverdueLog> overdueLogs = Lists.newArrayList();


    @ApiModelProperty("垫款回收记录")
    private List<AdvancesInfo> advancesInfos = Lists.newArrayList();


    @ApiModelProperty("催收记录")
    private List<UrgentLog> urgentLogs = Lists.newArrayList();


    @Data
    public static class BusinessInfo {

        @ApiModelProperty("融资银行")
        private String bankName;

        @ApiModelProperty(value = "分期金额，单位元", required = true)
        private Double installmentAmount;

        @ApiModelProperty(value = "执行费率，百分比", required = true)
        private Double rate;

        @ApiModelProperty("合同车价")
        private Double sellAmount;

        @ApiModelProperty(value = "融资金额", required = true)
        private Double financingAmount;

        @ApiModelProperty(value = "期数", required = true)
        private Long term;

        @ApiModelProperty(value = "放贷日期", required = true)
        private String lendDate;

        @ApiModelProperty(value = "还款卡号", required = true)
        private String repayCardNo;

        @ApiModelProperty(value = "扣款卡号", required = true)
        private String deductionCardNo;

    }


    @Data
    public static class CarInfo {

        @ApiModelProperty("车辆品牌(银行ocr识别)")
        private String bankCarBrand;

        @ApiModelProperty("车辆型号(银行ocr识别)")
        private String bankCarType;

        @ApiModelProperty("车架号")
        private String frameNo;

        @ApiModelProperty("发动机号")
        private String engineNo;

        @ApiModelProperty(value = "车身颜色", required = true)
        private String color;

        @ApiModelProperty(value = "开票日期yyyy-mm-dd", required = true)
        private String invoiceDate;

        @ApiModelProperty(value = "开票金额", required = true)
        private Double invoicePrice;

        @ApiModelProperty(value = "开票单位", required = true)
        private String invoiceUnit;

        @ApiModelProperty(value = "登记车主", required = true)
        private String registOwner;

        @ApiModelProperty("车牌号码")
        private String plateNo;

        @ApiModelProperty("首次登记日期")
        private String firstRegistDate;

        @ApiModelProperty("本次登记日期")
        private String registDate;


    }

    @Data
    public static class AdvancesOverdueInfo {

        @ApiModelProperty("逾期金额（当前逾期金额）")
        private Double overdueAmount;

        @ApiModelProperty("垫款金额（已垫款金额）")
        private Double advancesAmount;

        @ApiModelProperty("最高逾期金额")
        private Double overdueMaxAmount;

        @ApiModelProperty("当期期数")
        private Long currentTerm;

        @ApiModelProperty("累计逾期期数")
        private Integer overdueCount;
    }

    @Data
    public static class OverdueLog {

        @ApiModelProperty("期数")
        private Integer term;

        @ApiModelProperty("导入时间")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private LocalDateTime importTime;

        @ApiModelProperty("数据日期")
        private String dataDate;

        @ApiModelProperty("应还金额")
        private Double payableAmount;

        @ApiModelProperty("逾期金额")
        private Double overdueAmount;

        @ApiModelProperty("最高逾期金额")
        private Double maxOverdueAmount;

    }
}
